package org.nowcoder.huawei.other;

/**
 * NC61: 两数之和
 */
public class NC61 {

    public static int[] nc61(int[] numbers, int target) {
        int[] result = new int[2];
        for (int i = 0; i < numbers.length; i++) {
            if (numbers[i] >= target) continue; //牛逼优化...
            for (int j = i + 1; j < numbers.length; j++) {
                if (numbers[i] + numbers[j] == target) {
                    result[0] = i + 1;
                    result[1] = j + 1;
                    return result;
                }
            }
        }
        return result;
    }
}
